#include<stdio.h>
#include<unistd.h>
#include<string.h>

int main()
{
#define NUM 100
    char bar[NUM+1];
    memset(bar,'\0',sizeof(bar));
    const char *lable="|/-\\";
    int i =0;
    while(i<=50)
    {
      printf("\032[%-50s][%d%%] %c\r",bar,i*2,lable[i%4]);
      fflush(stdout);
      bar[i] = '#';
      i++;
      usleep(50000);
    }
}
